import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class test03
{

	public static void main(String[] args)
	{
		//检查字符串是否符合规则pattern
		String str = "abc123&&edf456&&xyz789";
		String pat = "[0-9]";
		
		//表达式对象
		Pattern pattern = Pattern.compile(pat);
		
		//创建MATCHER对象
		Matcher matcher = pattern.matcher(str);
	
		
		//替换
		String newStr = matcher.replaceAll("#");
		System.out.println(newStr);
		
	}

}
